package com.example.Bean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@Slf4j
public class SimpleDI {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext ctx=new ClassPathXmlApplicationContext("classpath:com/example/Bean/spring-xml.xml");
        Stu stu=ctx.getBean("stuid",Stu.class);
        log.debug("{}",stu);
        ctx.registerShutdownHook();

        XmlDemo demo1=ctx.getBean("demo1",XmlDemo.class);
        log.debug("{}",demo1.getName());
        XmlDemo demo2=ctx.getBean("demo2",XmlDemo.class);
        log.debug("{}",demo2.getName());

        XmlDemo hello_demo=ctx.getBean("hello_demo",XmlDemo.class);
        log.debug("{}",hello_demo.getWorld().getId());
    }
}